<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\ResourceCollection;
use Illuminate\Http\Resources\Json\JsonResource;
class ReplayMiniCollection extends JsonResource
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    // 'id','title','subtitle','cover','play_time','video_audio','is_vip'
    public function toArray($request)
    {
        $data = [
            'id'=>$this->id,
            'title'=>$this->title,
            'subtitle'=>$this->subtitle,
            'cover'=>$this->cover,
            'play_time'=>$this->play_time?strtotime($this->play_time):time(),
            'video_audio'=>$this->video_audio,
            'is_vip'=>$this->is_vip,
        ];
        return $data;
    }
}
